package com.example.myapplication.module_notification;

import android.content.Context;
import android.os.Bundle;

import com.bumptech.glide.Glide;
import com.example.myapplication.data.Notification;
import com.example.myapplication.databinding.DetailOfNotificationActivityBinding;
import com.example.myapplication.utils.AndroidShare;
import com.google.android.material.appbar.CollapsingToolbarLayout;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;

import com.example.myapplication.R;

import org.sufficientlysecure.htmltextview.HtmlHttpImageGetter;
import org.sufficientlysecure.htmltextview.HtmlTextView;

public class DetailOfNotificationActivity extends AppCompatActivity {

    private DetailOfNotificationActivityBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = DetailOfNotificationActivityBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        Notification notification = (Notification) getIntent().getSerializableExtra("noti");

        Glide.with(this).load(notification.getCoverUrl()).into(binding.notiCover);
        binding.notiTitle.setText(notification.getTitle());
        binding.detailNotificationContent.setHtml(notification.getContent(),new HtmlHttpImageGetter(binding.detailNotificationContent));
        Context context = this;
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        if (item.getItemId()== android.R.id.home){
            finish();
        }
        return super.onOptionsItemSelected(item);
    }
}